Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Monkey patch GUI elements #151

Merged
merged 10 commits into from
Oct 12, 2022
Merged

Monkey patch GUI elements #151

merged 10 commits into from
Oct 12, 2022

Conversation

niklassiemer
Copy link
Member

No description provided.

@niklassiemer niklassiemer requested a review from pmrv July 12, 2022 06:13
@niklassiemer
Copy link
Member Author

ping @pmrv

Comment on lines 30 to 35
if hasattr(cls, attr_name):
warnings.warn(
f"Class {cls.__name__} already has attribute {attr_name} - Aborting monkey path of gui elements."
)
else:
setattr(cls, attr_name, value)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might break in a similar way under reloading module has @jan-janssen pointed out in pyiron_base#808. I discussed a potential fix there also.

pyiron_gui/monkey_patching.py Outdated Show resolved Hide resolved
@niklassiemer niklassiemer added the format_black reformat the code using the black standard label Sep 12, 2022
@niklassiemer niklassiemer added format_black reformat the code using the black standard and removed format_black reformat the code using the black standard labels Sep 22, 2022
@niklassiemer
Copy link
Member Author

@pmrv I now think this should be absolutely safe to reload.

@niklassiemer niklassiemer requested a review from pmrv October 11, 2022 08:04
Copy link
Contributor

@pmrv pmrv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

pyiron_gui/monkey_patching.py Outdated Show resolved Hide resolved
pyiron_gui/monkey_patching.py Outdated Show resolved Hide resolved
pyiron_gui/monkey_patching.py Outdated Show resolved Hide resolved
@niklassiemer niklassiemer merged commit e51cb86 into master Oct 12, 2022
@delete-merged-branch delete-merged-branch bot deleted the monkey branch October 12, 2022 09:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
format_black reformat the code using the black standard
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants